package com.hugoo.form.xo;

import com.hugoo.core.util.TL;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Lovelock.Chan
 */
public abstract class XVar extends XDBL{

    protected String id;
    protected String para;
    protected String attr;
    protected String inst;
    
    protected List<String> paraList = new ArrayList();
    protected List<String> attrList = new ArrayList();
    protected List<String> instList = new ArrayList();

    public List<String> getParaList() {
        return paraList;
    }

    public List<String> getAttrList() {
        return attrList;
    }

    public List<String> getInstList() {
        return instList;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id.toUpperCase();
    }

    public String getPara() {
        return para;
    }

    public void setPara(String para) {
        if (para != null) {//不区分大小写
            this.para = para.toUpperCase();
            addToList(this.para, paraList);
        }
    }

    private void addToList(String pl, List ls) {
        if (TL.isNotEmpty(pl)) {
            String lx[] = pl.split(",");
            for (String l : lx) {
                if (TL.isEmpty(l)) {
                    continue;
                }
                ls.add(l);
            }
        }
    }

    public String getAttr() {
        return attr;
    }

    public void setAttr(String attr) {
        if (attr != null) {
            this.attr = attr.toUpperCase();
            addToList(this.attr, attrList);
        }
    }

    public String getInst() {
        return inst;
    }

    public void setInst(String inst) {
        if (inst != null) {
            this.inst = inst.toUpperCase();
            addToList(this.inst, instList);
        }
    }

   
}
